#!/bin/sh
##################### restart add_wechat_stream_server server #############################
PID_RANK=$(ps -ef | grep add_wechat_stream_server.py | grep -v grep | awk '{print $2}' | xargs)
if [ "$PID_RANK" != "" ]; then
  echo "-----Force kill current server process"
  kill -9 $PID_RANK
fi
#echo '' > internal_server.log

nohup python3 /home/work/workdir/project/LLM_internal/internal_server/bot/insurance_planner_gpt/add_wechat_stream_server.py >>add_wechat_stream_server.log 2>&1 &

################## check if server startup ##########################
PID_RANK=$(ps -ef | grep add_wechat_stream_server.py | grep -v grep | awk '{print $2}')

if [ "$PID_RANK" == "" ]; then
  echo "startup fail please check log file."
  exit 1
fi

echo "startup add_wechat_stream_server success!!!"
